10 REM   HELIACAL RISE AND SET
11 P1=3.14159265 : R=P1/180
12 P2=P1/2 : P3=1.5*P1 : P4=2*P1
13 A8=LOG(10) : R1=.017202
14 INPUT "EXTINCTION";K
15 INPUT "LIMITING MAG";M0
16 INPUT "STAR MAG.";M
17 INPUT "STAR R.A. (HOURS)";A1
18 INPUT "     DEC. (DEG.) ";D1
19 INPUT "OBS LATITUDE     ";L
20 A1=A1*15*R : D1=D1*R : L=L*R
21 S1=SIN(D1) : C1=COS(D1)
22 S7=SIN(L) :  C7=COS(L)
23 INPUT "RISE OR SET";R$
24 R$=LEFT$(R$,1)
25 IF R$="R" THEN F=1
26 IF R$="S" THEN F=-1
27 V1=-S7*S1/(C7*C1)
28 IF V1=0 THEN H1=P1/2
29 IF V1=0 THEN 32
30 IF V1<-1 THEN V1=-1
31 H1=ATN(SQR(1-V1*V1)/V1)
32 IF V1<0 THEN H1=H1+P1
33 H1=A1-F*H1
34 X=-.2*(M0-7.93+K)
35 B0=79.4*(10^X-1)^2-K*589
36 D=80+A1*58.13-60*F
37 D=D+F : G=D*R1-.062
38 PRINT "  TRIAL DAY: ";INT(D)
39 L0=D*R1-1.406+.033*SIN(G)
40 A0=ATN(.917*SIN(L0)/COS(L0))
41 D0=.398*SIN(L0)
42 D0=ATN(D0/SQR(1-D0*D0))
43 IF L0<P2 OR L0>P3 THEN 45
44 A0=A0+P1
45 IF L0>P3 THEN A0=A0+P4
46 C0=-S7*SIN(D0)/(C7*COS(D0))
47 H0=ATN(SQR(1-C0*C0)/C0)
48 IF C0<0 THEN H0=H0+P1
49 H0=A0-F*H0
50 IF F*(H1-H0)>0 THEN 37
51 N=-100 : T=H1-F/30
52 T=T+F/30
53 IF F*(T-H0)>0 THEN 37
54 N0=N : REM  LIMITING MAG.
55 A9=S7*S1+C7*C1*COS(A1-T)
56 IF A9<-1 THEN A9=-1
57 IF A9=0 THEN Z1=P1/2
58 IF A9=0 THEN 60
59 Z1=ATN(SQR(1-A9*A9)/A9)
60 A9=C7*COS(D0)*COS(T-A0)
61 A9=A9+S7*SIN(D0)
62 H5=ATN(A9/SQR(1-A9*A9))
63 A9=C1*COS(D0)*COS(A0-A1)
64 C2=A9+S1*SIN(D0)
65 A9=C2-COS(Z1)*SIN(H5)
66 A9=A9/(SIN(Z1)*COS(H5))
67 IF A9<-1 THEN A9=-1
68 T1=ATN(SQR(1-A9*A9)/A9)
69 A5=.025*EXP(-11*COS(Z1))
70 A5=1/(COS(Z1)+A5)
71 L5=H5*(8.2*Z1+12)+2.86*Z1
72 L5=4.75-T1*Z1/3+L5
73 B=B0+(K/.2)*(10^L5)
74 IF L5<2.07 THEN B=B0+K*589
75 C5=4.466E-09 : K5=1.258E-06
76 IF B<1649 THEN C5=1.58E-10
77 IF B<1649 THEN K5=.0126
78 N=C5*(1+SQR(K5*B))^2
79 N=-16.57-K*A5-2.5*LOG(N)/A8
80 IF N>N0 THEN 52
81 IF N0<M THEN 37
82 IF D>=366 THEN D=D-365.25
83 PRINT "DAY OF YEAR: ";INT(D)
84 PRINT "STAR: ";INT(90.5-Z1/R)
85 PRINT "SUN:  ";INT(H5/R+.5)
86 END
87 REM  ------------------------
88 REM  APPEARED IN ASTRONOMICAL
89 REM  COMPUTING, SKY & TELE-
90 REM  SCOPE, SEPTEMBER, 1985
91 REM  ------------------------
